<?php defined('SYSPATH') or die('No direct script access.');

class Controller_Base_Backend extends Controller_Admin {
	
	private $adm_root;

	public function __construct(Request $request, Response $response) {
		
		parent::__construct($request, $response);
		
		$this->view = Smarty_View::factory('base/html.tpl');
        
        $this->view->js = array(
//			"jquery-1.7.1.min"=> array(
//				"type"=>"text/javascript",
//				"src"=>DOC_ROOT."modules/dec/static/jscript/jquery-1.7.1.min.js",
//				),
			"jquery-1.8.2.min"=> array(
                                "type"=>"text/javascript",
                                "src"=>DOC_ROOT."modules/dec/static/jquery-ui-1.9.1.custom/js/jquery-1.8.2.js",
                                ),
			"jquery-ui"=> array(
				"type"=>"text/javascript",
				"src"=>DOC_ROOT."modules/dec/static/jquery-ui-1.9.1.custom/js/jquery-ui-1.9.1.custom.min.js",
				),
			"jquery-ui-datepicker-pt-BR"=> array(
				"type"=>"text/javascript",
				"src"=>DOC_ROOT."modules/dec/static/jscript/jquery.ui.datepicker-pt-BR.js",
				),
			"general"=> array(
				"type"=>"text/javascript",
				"src"=>DOC_ROOT."modules/dec/static/jscript/general.js",
				),
		);
		$this->view->css = array(
			"jquery-ui"=> array(
				"rel"=>"stylesheet",
				"href"=>DOC_ROOT."modules/dec/static/jquery-ui-1.9.1.custom/css/ui-lightness/jquery-ui-1.9.1.custom.min.css",
				"type"=>"text/css",
				"media"=>"screen",
				"charset"=>"utf-8",
			),
			"general"=> array(
				"rel"=>"stylesheet",
				"href"=>DOC_ROOT."modules/dec/static/css/general.css",
				"type"=>"text/css",
				"media"=>"screen",
				"charset"=>"utf-8",
			),
			"backend"=> array(
				"rel"=>"stylesheet",
				"href"=>DOC_ROOT."modules/dec/static/css/backend.css",
				"type"=>"text/css",
				"media"=>"screen",
				"charset"=>"utf-8",
			),
		);
        $this->view->meta = array();
        $this->view->meta[] = array("http-equiv" => "Content-Type", "content" => "text/html;charset=UTF-8");
        
		$this->view->body = Smarty_View::factory('base/body_backend.tpl');
		if(isset(Kohana::$config->load('dec')->google_key) && !empty (Kohana::$config->load('dec')->google_key)) {
			$this->view->body->google_key = Kohana::$config->load('dec')->google_key;
		}
		
		$this->view->title = Kohana::$config->load('dec')->adm_root." - ".Kohana::$config->load('dec')->sys_name;
		$this->view->body->top = Smarty_View::factory('adm/top.tpl');
		$this->view->body->login = Decauth::backend();
		$this->view->body->footer = Arr::get(Kohana::modules(), "i18nUrl") ? (Views::Language(($redirect = substr(Request::current()->uri(),6))=="adm/home/index"?'adm/':$redirect)) : "Default Footer";
		if (Kohana::$profiling) $this->view->body->profile = View::factory('profiler/stats');
	}

} // End Backend